<template>
    <div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>姓名</label>
            </div>
            <div>
                <p>{{detailData.UserName}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>性别</label>
            </div>
            <div>
                <p>{{detailData.Sex}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>身份证号码</label>
            </div>
            <div>
                <p>{{detailData.IdentifyNo}}</p>
            </div>
        </div>
        <div class="form-item form-item-style1">
            <div class="label-title">
                <label>证件有效期</label>
            </div>
            <div>
                <p>{{detailData.PaperValidateTo?detailData.PaperValidateTo.split(' ')[0]:''}}</p>
            </div>
        </div>
        <div class="cut-off-rule"></div>
        <div class="form-section">
            <h3 data-v-d3024438="">附件</h3>
            <div class="form-item form-item-style1"
                 @click="preview(detailData.AttchFile)">
                <div class="label-title label-title1">
                    <label>附件</label>
                </div>
                <div class="right-section">
                    <span>预览</span>
                    <x-icon type="ios-arrow-right"
                            size="20"
                            class="icon-right"></x-icon>
                </div>
            </div>
        </div>
        <myMenu></myMenu>
    </div>
</template>
<script>
import myMenu from '@/commonComponents/menu'
import upload from '@/commonComponents/upload/index'
export default {
    name: 'operatingPersonnel',
    data () {
        return {
            userInfo: '',
            detailData: {},
            imgList: [],
            regImg: /\.(png|jpg|PNG|JPG|jpeg|JPEG|gif|GIF)$/
        }
    },
    created () {
        this.userInfo = JSON.parse(localStorage.getItem('userInfo')) || {}
        if (this.$route.query.id) {
            this.getDetail()
        } else if (this.$route.query.userDetail) {
            this.detailData = JSON.parse(this.$route.query.userDetail)
            // this.imgList.push(this.detailData.AttchFile)
        }
    },
    components: {
        upload,
        myMenu
    },
    methods: {
        preview (filePath) {
            if (this.regImg.test(filePath)) {
                this.$router.push({
                    path: '/previewImg',
                    query: {
                        previewImg: filePath
                    }
                })
            } else {
                wx.miniProgram.navigateTo({
                    url: `/pages/openDocument/index?filePath=${filePath}`
                })
            }
        },
        getDetail () {
            let params = {
                'allowPaging': true,
                'business': 'getSpecialEquipmentOperationDetail',
                'data': {
                    id: this.$route.query.id
                },
                'pageIndex': 0,
                'pageSize': 20,
                'tokenId': '',
                'userId': this.userInfo.userid
            }
            this.$axiosAjax.getConfigJson(params).then((res) => {
                if (res.data.code === 0) {
                    this.detailData = res.data.data
                    // this.imgList.push(this.detailData.AttchFile)
                }
            }).catch(() => {

            }).finally(() => {
                this.$vux.loading.hide()
            })
        }
    }
}
</script>
<style lang="less" scoped>
</style>
